package com.kmair.caiwu.attendance.services;

import com.kmair.caiwu.attendance.dao.VacationUsedRecordMapper;
import com.kmair.caiwu.attendance.pojo.VacationUsedRecord;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class VacationUserRecordService {
    private final VacationUsedRecordMapper dao;

    @Autowired
    public VacationUserRecordService(VacationUsedRecordMapper dao) {
        this.dao = dao;
    }

    @Transactional(propagation = Propagation.SUPPORTS)
    public List<VacationUsedRecord> selectSelectiveByGroup(String uId, Integer pYear) {
        return dao.selectSelectiveByGroup(uId, pYear);
    }

    @Transactional(propagation = Propagation.REQUIRED)
    public int insertSelective(VacationUsedRecord record) {
        return dao.insertSelective(record);
    }

    @Transactional(propagation = Propagation.REQUIRED)
    public void sumVaction() {
        dao.sumVaction();
    }
}
